package dao.impl;

import com.google.common.collect.ImmutableMap;
import dao.CaptchaDao;
import domain.Captcha;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * Created by aceyin on 15/6/23.
 */
@Repository
public class CaptchaDaoImpl extends BaseGenericDao<Captcha, Long> implements CaptchaDao {
    @Override
    public Captcha findLatestByUsage(String mobile, String usage) {
        ImmutableMap.Builder<String, Object> builder = ImmutableMap.<String, Object>builder();
        builder.put("mobile", mobile).put("usage", usage);
        Map<String, Object> params = builder.build();
        return queryOne("get-captcha-by-usage", params);
    }
}
